//
// Created by Jisam on 30/08/2024 9:08 PM.
// Solution of  P4552 [Poetize6] IncDec Sequence
// 2024-08-30 21:24:26 AC 100
//#pragma GCC optimize(3)
#include <bits/stdc++.h>

using namespace std;
#define endl "\n"
#define PSI pair<string,int>
#define PII pair<int,int>
#define PDI pair<double,int>
#define PDD pair<double,double>
#define VVI vector<vector<int>>
#define VI vector<int>
#define VS vector<string>
#define PQLI priority_queue<int, vector<int>, less<int>>
#define PQGI priority_queue<int, vector<int>, greater<int>>
#define code_by_jisam ios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
typedef long long i64;
typedef unsigned u32;
typedef unsigned long long u64;
typedef __int128 i128;
int dx[] = {-1, 1, 0, 0, 1, 1, -1, -1,};
int dy[] = {0, 0, -1, 1, 1, -1, -1, 1,};

// 定义最大数组长度常量
const int MAXN = 1e5 + 5;
// 定义整型数组a，用于存储n个整数，初始值均为0
i64 tz,tf,a[MAXN]={0};

void solution() {
    // 声明并读取整数n
    int n;
    cin >> n;
    // 读取n个整数存入数组a中
    for(register int i = 1 ; i <= n; i ++){
        cin >> a[i];
    }

    // 遍历数组a，计算相邻元素的差值
    for(register int i = 2; i <= n ; i ++){
        int num = a[i] - a[i -1];
        // 如果差值为正，则累加到tz
        if(num > 0) tz += num;
        // 如果差值为负，则从tf中减去
        else tf -= num;
    }
    // 输出tz和tf中较大的值，以及tz和tf差值的绝对值加1的结果
    cout << max(tz,tf) <<endl << abs(tz-tf) + 1;
}


int main() {
    code_by_jisam;
    int T = 1;
//    cin >> T;
    while (T--) {
        solution();
    }
    return 0;
}